<?php 
class App_Admin_Pager_Plugin extends Main_Pager
{
	/**
	 * @var array
	 */
	protected $_fields = array(
		'id'   => array('simpleSearch' => true, 'sql' => 'plugin.id'),
		'name' => array('simpleSearch' => true, 'sql' => 'plugin.name'),
		'title' => array('simpleSearch' => true, 'sql' => 'plugin_i18n.title'),
		'description' => array('simpleSearch' => true, 'sql' => 'plugin_i18n.description'),	
	);
	
	/**
	 * @return void
	 */
	protected function _init()
	{
		$this->_config['base'] = "
			SELECT 
				plugin.id
				, plugin.name
				, plugin.f_active
				, plugin_i18n.title
				, plugin_i18n.description  	
			FROM
				plugin 
			INNER JOIN
				plugin_i18n 
				ON
					(plugin.id=plugin_i18n.plugin_id AND plugin_i18n.lang_id={$this->_langId})
			WHERE true		
		";
				
		$this->_config['count'] = "
			SELECT 
				COUNT(plugin.id)
			FROM
				plugin 
			INNER JOIN
				plugin_i18n 
				ON
					(plugin.id=plugin_i18n.plugin_id AND plugin_i18n.lang_id={$this->_langId})
			WHERE true	
		";		

		$this->_service = new App_Admin_Service_Plugin();
						
		parent::_init();			
	}
	
	/**
	 * @param int|string $primary
	 * @return bool
	 */
	protected function _deleteItem($primary) 
	{
		return $this->_service->deleteItem($primary);
	}
}


